<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js App"/>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import axios from 'axios'
export default {
  name: 'app',
  components: {
    HelloWorld
  },
  created() {
    this.getXiaoMi()
  },
  methods: {
    getXiaoMi(){
      axios({
        method:'post',//post提交
        url:'/xiaomi/v1/home/page',
        headers: {
         'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'//设置from表单提交
        },
        data: { //表单数据（一般post提交）
            'client_id': '180100031051',
            'channel_id': '0',
            'webp': '1',
            'page_type': 'home'  
        },
        params: { //路径拼写的数据（一般get提交）
            // 'client_id': '180100031051',
            // 'channel_id': '0',
            // 'webp': '1',
            // 'page_type': 'home' 
        }
      }).then(data => {
       console.log(data)
     })
    }
  },
}
</script>

<style lang="scss">
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
